    function doAjaxPost() {
       // alert("inside ");
        var post = $('#post').val();
 if(post.replace(/^\s+|\s+$/g, '').length == 0){
	 //alert("you have to write something");
	 $(".check-post-error").css("visibility",   "visible");
	 document.getElementById('err1').style.display = "block";
	 }
 else{
	 document.getElementById('err1').style.display = "none";
	 $(".check-post-error").css("visibility", "hidden");
        $.ajax({
        type: "POST",
        url: "/sales/s/chatter",
        data: "post="+post,
        success: function(response){
        $('#post').val('');
    //  alert(response);
      $('.chatter-share-actions').after(response);
        },
        error: function(e){
        }
        });
        }}
    
    function doAjaxComment() {
    	// alert("inside comment");
		 var commentContainer = $('.comment-btn').parent().find('.comment').last();
		// alert(commentContainer);
		 if( commentContainer.attr('class') != "comment"){
			 //alert("failed to find class");
			 commentContainer = $(this).parent();
		 }
		 var currentPostId = $('.comment-btn').parent().parent().attr('id');
		 //alert(currentPostId);
		 var comment = $('.comment-btn').parent().find('textarea').attr('value');
		// alert(comment);
		 var commentTxtarea = $('.comment-btn').parent().find('textarea');
		// alert(commentTxtarea);
		 if(comment.replace(/^\s+|\s+$/g, '').length == 0){
			 document.getElementById('err2').style.display = "block";
			 $(".check-post-error").css("visibility",   "visible");
			 }
		 else{
			// alert("inside else");
			 document.getElementById('err2').style.display = "none";
			 $(".check-post-error").css("visibility", "hidden");
			 $.ajax({
		        type: "POST",
		        url: "/sales/s/comment",
		        data: "PostId="+currentPostId+"&comment="+comment,
		        success: function(response){
			          $('.test').append(response);
			        },
		        error: function(e){
		        //alert('Error: ' + e);
		        }
		        }); 
        }}
